public class Deck {
	final static int DECK_SIZE = 54;

	public static Card[] cards = new Card[DECK_SIZE]; // the cards - cards[0] is
	// bottom of
	// deck
	private int N; // number of cards
	private int count = 0;

	public Deck() {

		for (int suit = 0; suit <= 5; suit++) {
			for (int rank = 1; rank <= 9; rank++) {
				cards[N] = new Card(count, count + ".gif", "back.gif");
				count++;
				N++;
			}
		}
		N = DECK_SIZE;
	}

	public static int deckSize() {
		System.out.println(cards.length);
		return cards.length;
	}

	// public Card dealFrom() {
	// return cards[--N];
	// }
	//
	// public boolean isEmpty() {
	// return (N == 0);
	// }

	// shuffles cards
	public void shuffle() {
		for (int i = 0; i < N; i++) {
			int r = (int) (Math.random() * (i + 1)); // between 0 and i
			Card swap = cards[i];
			cards[i] = cards[r];
			cards[r] = swap;
		}
	}

	// return string representation
	public String toString() {
		String s = "Deck  ";
		for (int i = 0; i < N; i++)
			s += cards[i] + " ";
		return s;
	}

	// test client
	public static void main(String[] args) {
		Deck deck = new Deck();
		// System.out.println(deck);
		deck.shuffle();
		System.out.println(deck);
		// deckSize();
	}

}